<template>
	<view>
		<view style="height: 100rpx;"></view>
		<view class="btn" @click="toIndex">
			<view class="icon" >
				<image class="icon_yuyue" src="../../static/icon_tianxie.png" mode="widthFix"></image>
			</view>
			<view class="text">
				<text>校内教职工填报</text>
			</view>
		</view>
		<view class="btn" @click="toInviteIndex">
			<view class="icon">
				<image class="icon_zhigong" src="../../static/icon_yaoqing.png" mode="widthFix"></image>
			</view>
			<view class="text">
				<text>邀请校外访客填报</text>
			</view>
		</view>
	</view>
</template>

<script>
	let Base64 = require('js-base64').Base64
	export default {
		data() {
			return {

			}
		},
		onLoad() {
			this.params = window.location.href.split('?')[1] || ''
			if(this.getParam(location.href, "error")) {
				return uni.showModal({
				  content: decodeURIComponent(Base64.decode(this.getParam(location.href, "error"))),
				  showCancel: true,
				  confirmText:'切换其他账号',
				  cancelText: '我知道了',
				  success: (res) => {
					if(res.confirm) {
					  window.location.href = "https://passport.ustc.edu.cn/login?renew=true&service=http%3A%2F%2Fbwclf.ustc.edu.cn%2Fassets%2Fstatic%2F%23%2Fpages%2Fentry%2Fentry";
					} else {
					  window.location.href = "https://passport.ustc.edu.cn/login";

					}
				  }
				})
			}
			console.log('this.concatName', Base64.decode(decodeURIComponent(this.getParam(location.href, "concatWage"))));
		},
		methods: {
			toIndex() {
				uni.navigateTo({
					url: '/pages/employee/employee' + `?${this.params}`
				})
			},
			toInviteIndex() {
				uni.navigateTo({
					url: '/pages/invite/index' + `?${this.params}`
				})
			},
			getParam(path, name) {
				var reg = new RegExp("(^|\\?|&)" + name + "=([^&]*)(\\s|&|$)", "i");
				if (reg.test(path))
					return decodeURIComponent(RegExp.$2.replace(/\+/g, " "));
				return "";
			},
		}
	}
</script>

<style lang="scss">
.tip {
	margin: 30rpx;

	.title {
		font-size: 34rpx;
		margin-bottom: 10rpx;
	}
	.item {
		text-indent: 1rem;
		color: red;
	}
}
.btn {
	margin: 30rpx;
	background: #fff;
	border-radius: 20rpx;
	display: flex;
	align-items: center;
	padding: 30rpx;

	.icon {
		width: 160rpx;
		height: 160rpx;
		background: #2A82E4;
		border-radius: 50%;
		display: flex;
		align-items: center;
		justify-content: center;
	}
	.icon_yuyue {
		width: 100rpx;
		height: 100rpx;
	}
	.icon_zhigong {
		width: 140rpx;
	}
	.text {
		flex: 1;
		text-align: center;
		font-size: 38rpx;
		color: #333;
		text {
			display: inline-block;
		}
	}
}
</style>
